/**
 * 		SettingsSimpleFactory.java
 *  Adrián E. Córdoba 		16/06/2013
 */
package ar.com.adriancordoba.app.common.settings;

/**
 * Simple Factory class for settings object creation.
 * @author Adrián E. Córdoba
 */
public class SettingsSimpleFactory {
	public enum SettingsType {
		XML, TXT
	};

	private static Settings settings = null;

	/**
	 * Factory method for settings object creation allowing a choice between
	 * text and XML properties file.
	 * @param type Either TXT or XML.
	 * @return The appropriate Settings object.
	 */
	public Settings createSettings(SettingsType type) {
		if (settings == null) {
			if (type == SettingsType.XML)
				settings = new XMLSettings();
			else if (type == SettingsType.TXT)
				settings = new TxtSettings();
		}

		return settings;
	}
}
